package com.example.springmvcdemo2.exception;

import com.example.springmvcdemo2.respone.JsonResult;
import com.example.springmvcdemo2.respone.StatusCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.util.jar.JarEntry;

@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler
    public JsonResult handRunTimeException(RuntimeException e){
        log.error("Throwable:{}",e.getMessage());
        return new JsonResult(StatusCode.OPERATION_FAILED);
    }

}
